import request from '@/utils/axios'
import store from '@/store'

// 派单列表
export const getDispatchList = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/member/info/page',
    method: 'post',
    data: params
  })
}

export const managerPage = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/pe/manager/order/page',
    method: 'post',
    data: params
  })
}

export const memberOrgPage = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/member/info/org/page',
    method: 'post',
    data: params
  })
}

export const getMemberpeOrg = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/member/info/send/pe_org?diseaseType=peCheck',
    method: 'post',
    data: params
  })
}

// 批量派单 单个派单
export const batchDispatchApi = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/member/info/send',
    method: 'post',
    data: params
  })
}

// 批量派单 单个派单 团检
export const batchDispatchApiTuanJian = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/member/info/send?diseaseType=peCheck',
    method: 'post',
    data: params
  })
}

// 批量派单 专病单个派单
export const batchDispatchApiNew = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/member/info/send?diseaseType=weightLose',
    method: 'post',
    data: params
  })
}

// 会员基本信息
export const questionAnswer = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/question/answer/${params.questionnaireRecordId}/${params.empi}`
  })
}

// 会员基本信息
export const getMemberInfo = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/member/info/info/${params.empi}/${params.userId}?diseaseType=${params.diseaseType}`
  })
}

// 会员基本信息
export const getMemberInfoCheckAfter = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/member/info/info/${params.empi}/${params.userId}?diseaseType=${params.diseaseType}`
  })
}

// 健康宣教 知识库标签
export const getKnowledgeBaseTag = () => {
  return request.get({
    url: '/eprofile-web/api/template/info/articles-type',
    method: 'get'
  })
}

// 管理路径列表
export const counselingRead = (data) => {
  return request.get({
    url: `/eprofile-web/api/health/counseling/read`,
    data
  })
}

// 管理路径列表
export const getManagePathList = (data) => {
  return request.post({
    url: '/eprofile-web/api/manage/plan/page',
    data: data
  })
}

export function getManagePlanByDiseaseType(params: any) {
  return request.get({
    url: '/eprofile-web/api/member/info/getManagePlanByDiseaseType',
    params
  })
}

// 获取所有的用户
export const getAllUser = () => {
  return request.get({
    url: `/eprofile-web/api/member/info/manager/${store.userStore.orgId}`
  })
}

//群主负责人列表
export const getManagerLeader = () => {
  return request.get({
    url: `/eprofile-web/api/member/info/manager/leader`
  })
}

//群组列表
export const getMemberGroup = () => {
  return request.get({
    url: `/eprofile-web/api/member/info/group`
  })
}

// 团检机构群组列表
export const groupPeOrg = () => {
  return request.get({
    url: '/eprofile-web/api/member/info/groupPeOrg'
  })
}

// 获取所有的服务团队
export const getAllUserGroup = () => {
  return request.get({
    url: '/eprofile-web/api/member/info/group'
  })
}

// 模板详情列表
export const getTemplateDetailList = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/manage/plan/template-info',
    data: params
  })
}

// 管理路径详情
export const getManagePathDetail = (params: any) => {
  return request.post({
    url: `/eprofile-web/api/task/info/get`,
    data: params
  })
}

// 暂存
export const holdManagePath = (params: any) => {
  return request.post({
    url: '/eprofile-web/api/task/info/hold',
    data: params
  })
}

// 生成方案
export const generateManagePath = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/task/info/create`,
    params
  })
}

// 方案执行情况
export const getManagePathExecution = (params: any) => {
  return request.post({
    url: `/eprofile-web/api/task/detail/page/info`,
    data: params
  })
}

// 管理路径重新匹配
export const reMatchManagePath = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/manage/plan/rematch`,
    data: params
  })
}

// 获取健康管理报告地址
export const getHealthReportStatus = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/pdf/get/${params.empi}/${params.reportNo}`
  })
}

// 上传健康管理报告文件
export const createHealthReport = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/pdf/create/${params.empi}`
  })
}

// 根据id查询路径名称
export const getManagePathName = (params: any) => {
  return request.get({
    url: `/eprofile-web/api/manage/plan/getName/${params.id}`
  })
}

// 获取所有的管理路径
export const getAllManagePath = (data) => {
  return request.post({
    url: `/eprofile-web/api/manage/plan/list`,
    data
  })
}

// 获取饮食字典数据
export function getDietDict() {
  return request.get({
    url: `/path/api/diet/dict/all/web`
  })
}

// 获取运动字段数据
export function getSportDict() {
  return request.get({
    url: `/eprofile-web/api/sp/data/sport/list`
  })
}

// 模板新增更新
export function TemplateAddOrUpdate(data) {
  if (data.id) {
    return request.post({
      url: '/path/api/template/info/update',
      data
    })
  } else {
    return request.post({
      url: '/path/api/template/info/save',
      data
    })
  }
}

// 历史路径

export function getHistoryPath(data) {
  return request.post({
    url: `/eprofile-web/api/task/detail/execute?` + data
  })
}

// 批量推送方案
export function batchPushScheme(data) {
  return request.post({
    url: `/eprofile-web/api/task/info/batch-create`,
    data
  })
}

// 获取Ai推荐方案
export function getAiRecommendScheme(params: any) {
  return request.get({
    url: `/eprofile-web/api/getAiStatus/ai`,
    data: params
  })
}

// 获取ai生成方案
export function getAiRecommendSchemeDetail(params: any) {
  return request.get({
    url: `/eprofile-web/api/getAiStatus/generateModel`,
    data: params
  })
}

// 获取患者推荐摄入量
export function getPatientRecommendIntake(params: any) {
  return request.get({
    url: `/eprofile-web/api/getAiStatus/getExtInfo`,
    data: params
  })
}

// 获取方案第一次推送时间
export function getSchemeFirstPushTime(params: any) {
  return request.get({
    url: `/eprofile-web/api/task/detail/get/plan/start/time?` + params
  })
}

// AI周期任务
export function getAiCycleTask(params: any) {
  return request.post({
    url: `/eprofile-web/api/patientCycleTask/list`,
    data: params
  })
}
